import java.util.Scanner;

//最大公约数
public class hw5 {
    public static void main(String[] args) {
        System.out.println("请输入两个数：");
        Scanner sc = new Scanner(System.in);
        int ret = 1;
        System.out.println("1：");
        int num1 = sc.nextInt();
        //sc.nextInt();
        System.out.println("2：");
        int num2 = sc.nextInt();
        if (num1==0) {
            ret = num2;
        }else if (num2==0) {
            ret = num1;
        } else {
            int temp = Math.min(num1, num2);
            for (int i = 1; i <= temp ; i++) {
                if(num1 % i == 0 && num2 % i == 0) {
                    ret = i;
                }
            }
        }
        System.out.println("最大公约数：" + ret);

    }
}
